/*!
 * MindPlus
 * uno
 *
 */
#include <DFRobot_BC20_Gravity.h>

// 动态变量
String mind_s_WeiXingShuLiang, mind_s_WeiDu, mind_s_JingDu;
// 创建对象
DFRobot_BC20_IIC myBC20(0x33);


// 主程序开始
void setup() {
	Serial.begin(9600);
	delay(500);
	myBC20.LED_OFF();
  /*Initialize BC20*/
  myBC20.changeColor(RED);
  while (!myBC20.powerOn()) {
    myBC20.LED_ON();
    delay(500);
    myBC20.LED_OFF();
    delay(500);
  }
  myBC20.changeColor(BLUE);
  myBC20.LED_ON();
	myBC20.configSleepMode(eSleepMode_Disable);
  myBC20.setQGNSSC(ON);
  myBC20.changeColor(YELLOW);
  if (myBC20.getQGNSSC() == OFF) {
    myBC20.LED_ON();
    delay(500);
    myBC20.LED_OFF();
    delay(500);
  }
  myBC20.changeColor(CYAN);
	delay(100);
	myBC20.getQGNSSRD2();
	while (!(mind_s_WeiXingShuLiang>3)) {
		mind_s_WeiDu = (myBC20.Display_Location_Information(2));
		mind_s_JingDu = (myBC20.Display_Location_Information(3));
		mind_s_WeiXingShuLiang = (myBC20.Display_Location_Information(12));
		Serial.println(mind_s_WeiXingShuLiang);
		Serial.println(mind_s_JingDu);
		Serial.println(mind_s_JingDu);
		Serial.println((myBC20.Display_Location_Information(8)));
		Serial.println((myBC20.Display_Location_Information(5)));
		Serial.println("------");
	}
	myBC20.checkNBNetWorkUntilSuccess();
	myBC20.setServer("iot.dfrobot.com.cn", "1883");
	myBC20.ConnectCloud("gwjCEokMg","RwjCEokMgz");
	myBC20.publish("wQ6TWV_Wg","hello");
	myBC20.publish("wQ6TWV_Wg",(String(mind_s_JingDu) + String((String(",") + String(mind_s_JingDu)))));
}
void loop() {

}
